package com.atguigu.tingshu.user.startagy;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class StrategyFactory {

    @Autowired
    private Map<String,ItemTypeStrategy> strategyMap;

    public ItemTypeStrategy getStrategy(String itemType){
        ItemTypeStrategy itemTypeStrategy= strategyMap.get(itemType);
        log.info("实现类是：{}",itemTypeStrategy);
        return itemTypeStrategy;
    }
}
